import { domainService } from '~/config/server';
import { NetService } from '~/utils/net.service';
import { Inject, Debounce } from '~/core/decorator';
import { Service } from '~/core/service';

export class RuleRemovedService extends Service {
  @Inject(NetService)
  private netService: NetService;
  /**
   * 获取支持的规则剔除策略字段
   */
  @Debounce()
  public getRuleEliminateFields () {
    return this.netService.send({
      server: domainService.ruleRemovedController.getRuleEliminateFields,
    });
  }
  /**
   * 分页查询所有规则剔除策略
   */
  @Debounce()
  public queryAllRule (data, page) {
    return this.netService.send({
      server: domainService.ruleRemovedController.queryAllRuleEliminateStrategyPage,
      data,
      page,
    });
  }
  /**
   * 查询单个规则剔除策略
   */
  @Debounce()
  public queryRule (data) {
    return this.netService.send({
      server: domainService.ruleRemovedController.queryRuleEliminateStrategy,
      data
    })
  }
  /**
   * 新增规则剔除策略
   */
  @Debounce()
  public saveRule (data) {
    return this.netService.send({
      server: domainService.ruleRemovedController.saveRuleEliminateStrategy,
      data,
      loading: true
    });
  }
  /**
   * 停用规则剔除策略
   */
  @Debounce()
  public stopOrStartRule (data) {
    return this.netService.send({
      server: domainService.ruleRemovedController.stopOrStartRuleEliminateStrategy,
      data,
      loading: true
    });
  }
  /**
   * 修改规则剔除策略
   */
  @Debounce()
  public updateRule (data) {
    return this.netService.send({
      server: domainService.ruleRemovedController.updateRuleEliminateStrategy,
      data,
      loading: true
    });
  }
  /**
   * 队列历史注记
   */
  @Debounce()
  public queryRuleLogList (data, page) {
    return this.netService.send({
      server: domainService.ruleRemovedController.queryRuleEliminateStrategyLogList,
      data,
      page
    });
  }
  /**
   * 审批历史
   */
  @Debounce()
  public queryRuleLog (data) {
    return this.netService.send({
      server: domainService.ruleRemovedController.queryRuleEliminateStrategyLog,
      data
    });
  }
}
